library(ggplot2)
source('utils.R')
load('hh_cces_donors.rdata')


kk <- with(cces.donors,!is.na(cces.donors$cfscoreR))
gg= with(cces.donors,cbind(x=as.numeric(scale(cces.donors$cfscoreR[kk]))+mean(cces.donors$cfscoreR[kk],na.rm=T),type='DIME scores'))
gg <- as.data.frame(gg)
gg$x <- as.numeric(as.character(gg$x))
q <- qplot(data=gg,x=x,colour=type,geom='histogram',binwidth=.05)
q <- q + scale_color_grey('')
q <- q + theme_bw()
q <- q + theme(legend.pos=c(.8,.9),
               legend.background = element_blank(),
               legend.key = element_blank()
               )
q <- q + xlab('DIME Scores')
q <- q + xlim(-2,2)

##PDF
pdf(file='figures/fig_A2_dime_score_histogram.pdf',width=11,height=6)
print(q)
dev.off()

##EPS
cairo_ps(file='figures/fig_A2_dime_score_histogram.eps',width=11,height=6)
print(q)
dev.off()
